package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Mobile   string `gorm:"type:varchar(30);not null"`
	Password string `gorm:"type:char(32);not null"`
}

func (u *User) LoginFind(db *gorm.DB, mobile string) error {
	return db.Debug().Where("mobile=?", mobile).FirstOrCreate(&u).Error
}

func (u *User) SHangList(db *gorm.DB, id int64) error {
	return db.Where("id = ?", id).First(u).Error
}
